﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.IO;
namespace Auktionshus
{

    public class NetworkConnection
    {
        public StreamReader reader;
        public StreamWriter writer;

        public NetworkConnection()
        {
			try
			{
				SocketClient("127.0.0.1", 11000);
			}
			catch (Exception)
			{
				throw;
			}
        }

        /// <summary>
        /// Socket klient sættes op
        /// </summary>
        /// <param name="servername"></param>
        /// <param name="port"></param>
        public void SocketClient(string servername, int port)
        {
			try
			{
				TcpClient server = new TcpClient(servername, port);
				NetworkStream stream = server.GetStream();
				reader = new StreamReader(stream);
				writer = new StreamWriter(stream);
			}
			catch (Exception)
			{
				throw new Exception();
			}			
        }
    }
}
